//
//  VisitorView.m
//  NewWeiBo_OC
//
//  Created by 陈竹 on 16/2/23.
//  Copyright © 2016年 陈竹. All rights reserved.
//

#import "VisitorView.h"
#import <Masonry.h>
@interface VisitorView()
///圆圈视图
@property(nonatomic,strong)UIImageView *iconView;
///图标视图
@property(nonatomic,strong)UIImageView *homeView;
///遮罩视图
@property(nonatomic,strong)UIImageView *maskIconView;
///文字信息视图
@property(nonatomic,strong)UILabel *messageLabel;
///登陆按钮
@property(nonatomic,strong)UIButton *loginBtn;
///注册按钮
@property(nonatomic,strong)UIButton *registerBtn;
@end
@implementation VisitorView
#pragma mark - 懒加载
-(UIImageView *)iconView{
    if (_iconView==nil) {
        _iconView=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"visitordiscover_feed_image_smallicon"]];
    }
    return _iconView;
}
-(UIImageView *)homeView{
    if (_homeView==nil) {
        _homeView=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"visitordiscover_feed_image_house"]];
    }
    return _homeView;
}
-(UIImageView *)maskIconView{
    if (_maskIconView==nil) {
        _maskIconView=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"visitordiscover_feed_mask_smallicon"]];
    }
    return _maskIconView;
}
-(UILabel *)messageLabel{
    if (_messageLabel==nil) {
        _messageLabel=[[UILabel alloc]init];
        _messageLabel.text=@"关注一些人，回这里看看有什么惊喜关注一些人，回这里看看有什么惊喜";
        _messageLabel.textColor=[UIColor redColor];
        _messageLabel.font=[UIFont systemFontOfSize:14];
    }
    return _messageLabel;
}
-(UIButton *)loginBtn{
    if (_loginBtn==nil) {
        _loginBtn=[[UIButton alloc]init];
        [_loginBtn setBackgroundImage:[UIImage imageNamed:@"common_button_white_disable" ] forState:UIControlStateNormal];
        [_loginBtn setTitle:@"登陆" forState:UIControlStateNormal];
        [_loginBtn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    }
    return _loginBtn;
}

-(UIButton *)registerBtn{
    if (_registerBtn==nil) {
        _registerBtn=[[UIButton alloc]init];
        [_registerBtn setBackgroundImage:[UIImage imageNamed:@"common_button_white_disable" ] forState:UIControlStateNormal];
        [_registerBtn setTitle:@"注册" forState:UIControlStateNormal];
        [_registerBtn setTitleColor:[UIColor orangeColor] forState:UIControlStateNormal];
    }
    return _registerBtn;
}

-(void)layoutSubviews{
    [self setupUI];
}



//设置界面
-(void)setupUI{
    
    [self addSubview:self.iconView];
    [self addSubview:self.maskIconView];
    [self addSubview:self.homeView];
    [self addSubview:self.messageLabel];
    [self addSubview:self.loginBtn];
    [self addSubview:self.registerBtn];
    
    self.messageLabel.textAlignment=NSTextAlignmentCenter;
    //使用框架自动布局
    [self.iconView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.centerY.equalTo(self).offset(-40);
    }];
    [self.homeView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(self.iconView);
    }];
    
    [self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerX.equalTo(self.iconView);
        make.top.equalTo(self.iconView.mas_bottom).offset(20);
        make.width.mas_equalTo(224);
        make.height.mas_equalTo(36);
    }];
    [self.registerBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.messageLabel.mas_bottom).offset(20);
        make.left.equalTo(self.messageLabel);
        make.width.mas_equalTo(100);
        make.height.mas_equalTo(36);
    }];
    [self.loginBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.messageLabel);
        make.top.equalTo(self.registerBtn);
        make.size.equalTo(self.registerBtn);
    }];
    [self.maskIconView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self);
        make.right.equalTo(self);
        make.top.equalTo(self);
        make.bottom.equalTo(self.registerBtn);
    }];
    self.backgroundColor=[[UIColor alloc]initWithWhite:237.0 / 255.0 alpha:1];
    
    
}


@end
